if (!images.requestScreenCapture()) {
    console.log("申请截图权限不成功!!");
    exit();
} else {
    console.log("申请截图权限成功~~");
}
//单独测试要 获取截图要等10多秒，然后从看视频那块进去，后面会把下面三行删除
sleep(15000);
click(750,1355);
//代码从这里看
sleep(3000);
device.wakeUp();
var waiquanx=[419,389,402,448,484,521,598,660,688,687,657,595,518];
var waiquany=[982,1054,1130,1192,1209,1220,1208,1160,1087,1049,976,932,921];

var neiquanx=[423,393,407,452,486,521,597,655,681,682,653,592,519];
var neiquany=[985,1055,1128,1187,1204,1214,1202,1156,1085,1048,980,937,931];

var result_x=0;
var to_x=0;
var nwi=13;
var 图片路径 = "/storage/emulated/0/DCIM/";
var tux = 0;

var smjlThread = threads.start(function() {
    var 监控状态 = setInterval(function() {
        console.log(tux+"");
        var img = captureScreen();
        images.save(img,图片路径+tux+".png");
        tux++;
    }, 400)
});

// gesture(15000,[200,1420],[880,1420],[200,1420]);
gesture(25000,[200,1420],[890,1420],[190,1420]);
smjlThread.interrupt();
console.log(tux+"");

for(let i=1;i<tux;i++){
    var nwx=0;
    
        //读取本地图片/sdcard/1.png 
    var img = images.read(图片路径+i+".png"); 
    //判断图片是否加载成功
     if(!img){ toast("没有该图片"); exit(); } 
    //在该图片中找色，指定找色区域为在位置(400, 500)的宽为300长为200的区域，指定找色临界值为4 
    for(let j=0;j<nwi;j++){
        var nqx =images.pixel(img,neiquanx[j],neiquany[j]);
        var wqx =images.pixel(img,waiquanx[j],waiquany[j]);
        var wqxstr = colors.toString(wqx);
        var nqxstr = colors.toString(nqx);
        if(colors.isSimilar(nqxstr,wqxstr,10)){
            nwx++;
        }
    }
    
    if(result_x<nwx){
        result_x=nwx;
        to_x=i;
        }
        img.recycle();//释放内存    
    }
    log(to_x+"to_x");
    
    var tupa = images.read(图片路径+to_x+".png");
    var huakuai = images.read(图片路径+"滑块位置"+".png");
    let p = findImage(tupa, huakuai);
    if(p!=null){
        console.log(p.x+"----------"+p.y);
        gesture(5000,[162,1394],[p.x,p.y]);
    }
    tupa.recycle();//释放内存
    huakuai.recycle();//释放内存
    